Skip to main content

Why Gem5?

Accurate/Fast (enough)

One of the primary reasons we use gem5 because it gives an excellent compromise between simulation speed and simulation fidelity without having to learn electrical engineering.

The golden standard of simulations is, naturally, the precise language of SystemVerilog and the simulators and verifiers available with that toolchain 1. To use those systems we would require intimate knowledge of electrical engineering and fluency in hardware specification languages, so to alleviate that limitation we use gem5, which features a C++/Python interface and is still reasonably accurate in terms of simulation fidelity.

info

You might think we don't have as much appreciation for your skills as we should, because you could obviously learn a new programming language with relative ease; in fact, you probably did not too long ago. The tricky thing is that Hardware Description Langauges (HDLs) are significantly differnt than other programming languages for imperative specifications such as we are used to. Take for example the following piece of SystemVerilog:

//-----------------------------------------------------
// Design Name : mux_using_assign
// File Name : mux_using_assign.sv
// Function : 2:1 Mux using Assign
// Coder  : Deepak Kumar Tala
//-----------------------------------------------------
module mux_using_assign (
input wire din_0 , // Mux first input
input wire din_1 , // Mux Second input
input wire sel , // Select input
output wire mux_out // Mux output
);
//-------------Code Start-----------------
assign mux_out = (sel) ? din_1 : din_0;

endmodule //End Of Module mux

We can muddle our way through understanding this since it is well commented, but imagine trying to implement a gshare predictor using wires. Only Dr. Amaral has those kinds of skills...

It would not be fair to claim that HDL simulation has only verilog as a target, rather there are a number of higher abstractions (such as Chisel or CIRCT) which play a lot more like the languages we know, however this is still much harder to grasp than python and C++ and, contrary to popular belief, we do care about your well-being a little.

Used in Research

gem5 is widely used in the computer architecture literature.

Gem5 Citations

The number of papers using gem5 continues to increase as the system becomes more sophisticated. Right now, gem5 offers the most of what a computer architect would need to obtain data about a proposed modification with little effort spent on implementation when compared to verilog or other families

Extensible

As you will see throughout this class, the interface to add components to gem5 is simple. You do not need extensive knowledge of how electronics fit together or operate in order to make a useful component like a branch predictor, however the simulation will still give a passable approximation of what your proposed component would do to an actual chip during execution.